﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BBICMS.Model
{
    using BBICMS.Model.Validation;
    using Core;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    public partial class Link : AuditableEntity<int>
    {
       

        [Display(Name = "主题", Prompt = "主题")]
        [Required(ErrorMessage = "请输入主题")]
        public string Title { get; set; }


        [Display(Name = "链接", Prompt = "链接")]
        [Required(ErrorMessage = "请输入链接地址")]
        [Url(ErrorMessage = "网址格式不正确")]
        public string WebLink { get; set; }

        [Display(Name = "排序", Prompt = "排序")]
        [Required(ErrorMessage = "请输入排序")]
        [RegularExpression(@"^-?\d*$", ErrorMessage = "格式不正确")]
        public int Importance { get; set; }
           
        [Display(Name = "描述", Prompt = "描述...")]
        public string Description { get; set; }
        [Display(Name = "显示", Prompt = "显示")]
        public bool Active { get; set; }

      

        [Display(Name = "分类")]
        public int CategoryId { get; set; }

         public virtual LinkCategory LinkCategory { get; set; }
         public string CategoryTitle
         {
             get
             {
                 if (this.LinkCategory != null)
                 {
                     return this.LinkCategory.Title;
                 }
                 return string.Empty;
             }
         }
    }
}
